<!--
Copyright 2017 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<md-dialog aria-label="Create a new secret"
           layout="column"
           class="kd-create-secret-dialog">
  <md-dialog-content layout-padding>
    <h4 class="md-title">[[Create a new image pull secret|Create image pull secret dialog title. The message appears at the top of the dialog box.]]</h4>
    <div>[[The new secret will be added to the cluster|Create image pull secret dialog subtitle. Appears right below the title.]]</div>

    <form name="$ctrl.secretForm"
          ng-submit="$ctrl.createSecret()"
          novalidate>
      <kd-help-section>
        <md-input-container class="md-block"
                            layout-wrap>
          <label>[[Secret name|Label 'Secret name', which appears as a placeholder in an empty input field in the image pull secret creation dialog.]]</label>
          <input name="secretName"
                 ng-model="$ctrl.secretName"
                 md-maxlength="{{$ctrl.secretNameMaxLength}}"
                 ng-pattern="$ctrl.secretNamePattern"
                 required>
          <div ng-messages="$ctrl.secretForm.secretName.$error"
               role="alert"
               multiple>
            <div ng-message="pattern">
              [[Name must follow the DNS domain name syntax (e.g. new.image-pull.secret).|The text appears when the image pull secret name does not match the expected pattern.]]
            </div>
            <div ng-message="md-maxlength">
              [[Name must be up to {{::$$ctrl.secretNameMaxLength}} characters long.|The text appears when the image pull secret name exceeds the maximal length.]]
            </div>
            <div ng-message="required">[[Name is required.|Warning which tells the user that the image pull secret name is required.]]</div>
          </div>
        </md-input-container>
        <kd-user-help>
          [[A secret with the specified name will be added to the cluster in the namespace.|User help text for the create image pull secret dialog. Directly after this text a specific namespace is specified.]] <span class="kd-emphasized">{{$ctrl.namespace}}.</span>
          <a href="http://kubernetes.io/docs/user-guide/secrets/"
             target="_blank">
            [[Learn more|The text is used as a 'Learn more' link text in the image pull secret creation dialog.]]
            <i class="material-icons">open_in_new</i>
          </a>
        </kd-user-help>
      </kd-help-section>

      <kd-help-section>
        <md-input-container class="md-block"
                            layout-wrap>
          <label>[[Image pull secret data|Label 'Image pull secret data', which appears as a placeholder in an empty input field in the image pull secret creation dialog.]]</label>
          <input name="data"
                 ng-model="$ctrl.data"
                 class="kd-secret-data"
                 columns="1"
                 rows="5"
                 ng-pattern="$ctrl.dataPattern"
                 required>
          <div ng-messages="$ctrl.secretForm.data.$error"
               role="alert"
               multiple>
            <div ng-message="required">[[Data is required.|Warning which tells the user that the image pull secret data is required.]]</div>
            <div ng-message="pattern">[[Data must be Base64 encoded.|The text appears when the image pull secret data is not Base64 encoded.]]</div>
          </div>
        </md-input-container>
        <kd-user-help>
          [[Specify the data for your secret to hold. The value is the Base64 encoded content of a .dockercfg file.|User help text for the input of the "Image Pull Secret" data.]]
          <a href="http://kubernetes.io/docs/user-guide/images/#specifying-imagepullsecrets-on-a-pod"
             target="_blank">
            [[Learn more|The text is used as a 'Learn more' link text in the image pull secret creation dialog.]] <i class="material-icons">open_in_new</i>
          </a>
        </kd-user-help>
      </kd-help-section>

      <md-dialog-actions layout="row">
        <md-button class="md-primary"
                   type="submit">[[Create|The text is put on the 'Create' button in the image pull secret creation dialog.]]</md-button>
        <md-button ng-click="$ctrl.cancel()">[[Cancel|The text is put on the 'Cancel' button in the image pull secret creation dialog.]]</md-button>
      </md-dialog-actions>
    </form>
  </md-dialog-content>
</md-dialog>
